package cn.csq.observer;

/**
 * @author chengshanqing
 * @date Created in 2022/03/16 09:40
 */
public class MainTest {
    public static void main(String[] args) {
        //新增一个主题
        ConcreteSubject concreteSubject = new ConcreteSubject();

        //主题对应的观察者
        ConcreteObserver concreteObserverA = new ConcreteObserver("A");

        ConcreteObserver concreteObserverB = new ConcreteObserver("B");


        //主题添加观察者
        concreteSubject.addObserver(concreteObserverA);
        concreteSubject.addObserver(concreteObserverB);

        String newStat = "哈哈哈";

        concreteSubject.notifyObserver(newStat);


    }
}
